Standard Function Library - Details - File Functions
XstBinRead ( fileNumber, bufferAddress, maxBytes )
XstBinWrite ( fileNumber, bufferAddress, numBytes )
XstChangeDirectory ( @directory$ )
XstCopyFile ( @sourceFile$, @destFile$ )
XstDeleteFile ( @filename$ )
XstGetCurrentDirectory ( @directory$ )
XstGetDrives ( @count, @drive$[], @driveType[], @driveType$[] )
XstGetFileAttributes ( @filename$, @attributes )
XstGetFiles ( @filter$, @files$[] )
XstGetFilesAndAttributes ( @filter$, attributeFilter, @files$[], FILEINFO @info[] )
XstGetPathComponents ( @file$, @path$, @drive$, @dir$, @filename$, @attributes )
XstGuessFileName ( @old$, @new$, @guess$, @attributes )
XstLoadString ( @filename$, @text$ )
XstLoadStringArray ( @filename$, @text$[] )
XstLockFileSection ( fileNumber, mode, offset$$, length$$ )
XstMakeDirectory ( @directory$ )
XstRenameFile ( @old$, @new$ )
XstSaveString ( @filename$, @text$ )
XstSaveStringArray ( @filename$, @text$[] )
XstSaveStringArrayCRLF ( @filename$, @text$[] )
XstSetCurrentDirectory ( @directory$ )
XstUnlockFileSection ( fileNumber, mode, offset$$, length$$ )
 

XstBinRead()  bytesRead = XstBinRead ( fileNumber , address , maxBytes )

Read binary data from diskfile into memory.

bytesRead = number of bytes read into memory
fileNumber = file number returned by OPEN()
address = memory address to read file data into
maxBytes = maximum number of bytes to read

XstBinRead() reads up to maxBytes into memory at address from fileNumber, starting at the current value of the file pointer.

If fewer than maxBytes exist between the current file pointer and the end of file, all remaining bytes are read in. The number of bytes read into memory is returned in bytesRead unless an error occurs, in which case bytesRead contains -1 and $$XERROR contains the runtime error number.

An error is returned if a disk access error occurs, fileNumber is not open for reading, or the file pointer is at or beyond the end of file.

The READ statement is more efficient, safer, and usually more appropriate than XstBinRead() . READ never reads too much data, thereby writing outside the target variable. XstBinRead() will attempt to read any quantity of data into any address. Therefore, it can write data outside the appropriate area, which almost always leads to fatal memory faults that crash the program and the development environment.

READ only works with variables, strings, and arrays that are part of the language, however. When C library functions supply an address to receive data, XstBinRead() is an appropriate choice.

XstBinWrite()  error = XstBinWrite ( fileNumber , address , writeBytes ) 

Write binary data to diskfile from memory.

error = non-zero if an error occurred
fileNumber = file number returned by OPEN()
address = memory address to get data from
writeBytes = number of bytes to write to file

XstBinWrite() writes writeBytes from memory at address to fileNumber, starting at the current value of the file pointer.

0 is returned in error unless an error occurred, in which case ##ERROR contains the runtime error number.

An error is returned if a disk access error occurs, or fileNumber is not open for writing.

The WRITE statement is more efficient and usually more appropriate than XstBinWrite() . WRITE only works with variables, strings, and arrays that are part of the language, however. When C library functions supply an address of data to be saved, XstBinWrite() is an appropriate choice.

XstChangeDirectory()  error = XstChangeDirectory ( directory$ )

Change the default or working directory to directory$.

XstCopyFile()  error = XstCopyFile ( sourceFilename$ , newFilename$ )

Create a new file called newFilename$ and copy the contents of the existing sourceFilename$ into newFilename$.

XstDeleteFile()  error = XstDeleteFile ( filename$ )

Delete the specified filename$.

XstGetCurrentDirectory()  error = XstGetCurrentDirectory (@ directory$ )

Get the current default aka working directory name in directory$.

XstGetDrives()  error = XstGetDrives (@ count , @ drive$[] , @ type[] , @ type$[] )

Get the drives currently recognized by the system, where count contains the number of drives, drive$[] contains their names, type[] contains a drive type, and type$[] contains the name of the drive type. The standard library defines drive type constants - see xst.DEC . Note that UNIX systems present drives as directories, so drives are invisible.

XstGetFileAttributes()  error = XstGetFileAttributes (@ filename$ , @ attributes )

Get the file attributes of the specified filename$. The standard library defines file attribute constants - see xst.DEC .

XstGetFiles()  maxLength = XstGetFiles (@ filter$ , @ file$[] )

Get the array of file names in file$[] that corresponds to the filename filter$ string. filter$ can contain drive, path, and filename with " * " and " ? " wildcard characters.

XstGetFilesAndAttributes()  maxLen = XstGetFilesAndAttributes (@ filter $, @ filter , @ file$[] , FILEINFO @ info[] )

Get an array of filenames in file$[] and file information in info[] for the files specified by the drive/path/filename in filter$ and the file attributes in filter. The info[] array is type FILEINFO , as defined in " xst.DEC ". The number of characters in the longest filename is returned in maxLen.

XstGetPathComponents()  (@ file$ , @ path$ , @ drive$ , @ dir$ , @ filename$ , @ attributes )

Get the components of a file$. The path$, drive$, dir$, and filename$, and attributes of the specified file are returned.

XstGuessFileName()  XstGuessFileName (@ old$ , @ new$ , @ guess$ , @ attributes )
XstLoadString()  error = XstLoadString (@ filename$ , @ string$ )

Load the contents of filename$ into a string$. The length of string$ is the same as the number of bytes in filename$. string$ can contain any combination of ascii and/or binary bytes.

XstLoadStringArray()  error = XstLoadStringArray (@ filename$ , @ string$[] )

Load the contents of filename$ into string array string$[]. The contents of filename$ are broken into separate "lines" by any of the following newline byte sequences - "\r\n" , "\n\r" , "\n" .

The newline bytes are not put into string$[]. If the last characters in filename$ are a newline byte sequence, the last element of string$[] is an empty string aka "" .

XstLockFileSection()  error = XstLockFileSection ( filenumber , mode , offset$$ , length$$ ) 
XstMakeDirectory()  error = XstMakeDirectory (@ directory$ ) 
XstRenameFile()  error = XstRenameFile (@ oldName $ , @ newName $ ) 
XstSaveString()  error = XstSaveString (@ filename$ , @ text$ ) 
XstSaveStringArray()  error = XstSaveStringArray (@ filename$ , @ text$[] ) 
XstSaveStringArrayCRLF()  error = XstSaveStringArrayCRLF (@ filename$ , @ text$[] ) 
XstSetCurrentDirectory()  error = XstSetCurrentDirectory (@ directory$ ) 
XstUnlockFileSection()  error = XstUnlockFileSection ( filenumber , mode , offset$$ , length$$ )